<?php if(!defined('ROOT_PATH')) exit('Access Denied');?><dl class="Tabs">
<dt id="TagsTabs"><a href="#tabLinkList" class="select">列表</a> <a href="#tabLinkAdd">添加</a></dt>
<dd id="tabLinkList" style="display: block; ">
    <p class="operate">操作: 
<a href="#" onclick="checkAll('list-tag'); return false;">选择全部</a> , 
<a href="#" onclick="uncheckAll('list-tag'); return false;">全部不选</a>&nbsp;&nbsp;&nbsp;
选择项: <a href="#" onclick="if(confirm('确定删除?')){metaDelete();} return false;">删除</a>
</p>
<table class="list-table" id="list-tag">
<colgroup>
<col width="25">
<col width="50">
<col width="80">
<col width="150">
<col width="130">
</colgroup>
<thead>
<tr>
<th class="radius-topleft"> </th>
<th>链接类型</th>
<th>链接名称</th>
<th>链接地址</th>
<th class="radius-topright">链接说明</th>
</tr>
</thead>
<tbody>
             <?php if(is_array($linkdata)) foreach($linkdata AS $vlaue) { ?> 
<tr class="even" id="tag-<?php echo $vlaue["id"];?>">
<td><input type="checkbox" value="<?php echo $vlaue["id"];?>" name="aid[]"></td>
<td><?php if($vlaue["type"] == 0) { ?>文字链接<?php } else { ?>图片链接<?php } ?></td>
<td><a href="#" onclick="ajaxLoad('/admin.php/Admin_Links/edit/id/<?php echo $vlaue["id"];?>');return false;"><?php echo $vlaue["linkname"];?></a></td>
<td><?php echo $vlaue["url"];?></td>
<td><?php echo $vlaue["introduction"];?></td>
</tr>
                <?php } ?>

</tbody>
</table>	
        <div class="nav">
<div class="nav-content">
<ul>
<?php if(is_array($page['all_pages'])) foreach($page['all_pages'] AS $vlaue) { ?>
<?php if($page['current_page'] == $vlaue) { ?>
<li class="current">
 <a onclick="ajaxLoad('/admin.php/Admin_Links/main/p/<?php echo $vlaue;?>');return false;" href="#"><?php echo $vlaue;?></a>
 </li>
<?php } else { ?>
<li>
<a onclick="ajaxLoad('/admin.php/Admin_Links/main/p/<?php echo $vlaue;?>');return false;" href="#"><?php echo $vlaue;?></a>
</li>
 <?php } ?> 
<?php } ?>


</ul>
</div>
</div>
</dd>
<dd id="tabLinkAdd" style="display: none; ">
    <form action="/admin.php/Admin_Links/Add" method="post" name="add_link" id="add-link">
<ul id="add-post-option">
<li>
<label for="add-link-linkname" class="add-post-label">名称：</label>
                <input type="text" id="add-link-linkname" name="linkname" value="" class="add-post-text" />
</li>
<li>
<label for="add-link-type" class="add-post-label">类型：</label>
          		<input type="radio" checked="checked" value="0" name="type">文字链接：
  		<input type="radio" value="1" name="type">图片链接：
</li>
            <li>
<label for="add-link-linkimages" class="add-post-label">Logo：</label>
<input id="add-tag-linkimages" name="linkimages" type="text" value="" class="add-post-text" autocomplete="off">
</li>
<li>
<label for="add-link-url" class="add-post-label">链接地址：</label>
<input id="add-tag-url" name="url" type="text" value="" class="add-post-text" autocomplete="off">
</li>
            <li>
<label for="add-link-introduction" class="add-post-label">说明：</label>
<input id="add-tag-introduction" name="introduction" type="text" value="" class="add-post-text" autocomplete="off">
</li>
<li>
            	<label for="add-link-description" class="add-post-label"></label>
<input type="submit" id="add-link-submit" name="add-link-submit" value="添加链接" />
</li>
</ul>
</form>
</dd>
</dl>
<script>
Tabs(document.getElementById('TagsTabs'), 'select', 0);
$('#add-link').ajaxForm({
beforeSubmit: function(){
$("#add-link-submit").attr('disabled',true);
},
success: function(data){
if(data=='ok!') {
showMessage('添加成功！','tips');
$("#add-link-submit").attr('disabled',false);
ajaxLoad('/admin.php/Admin_Links');
} else {
showMessage(data,'error');
}
}});

function metaDelete() {
$("#list-tag input:checked").each(function(){
$.post(
'/admin.php/Admin_Links/del',
{'aid':$(this).val()},
function(response){
if(!response.success){
showMessage(response.message,'error');
}
},
"json"
);
});
ajaxLoad('/admin.php/Admin_Links');
}
</script>